package com.congiya.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	public static long dateDifference(Date fromDate, Date toDate) {
		return (toDate.getTime() - fromDate.getTime())
				/ (1000 * 60 * 60 * 24);
	}
	
	public static long dateDifference(Calendar fromDate, Calendar toDate) {
		return dateDifference(fromDate.getTime(), toDate.getTime());
	}
	
	public static long dateDifferenceToday(Calendar fromDate) {
		return dateDifference(fromDate.getTime(), Calendar.getInstance().getTime());
	}	
}
